﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace SocialShare.Web.Controls
{
    public partial class vwBreadCrumb : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void SiteMapPath1_ItemDataBound(object sender, SiteMapNodeItemEventArgs e)
        {
            if (e.Item.ItemType == SiteMapNodeItemType.Current)
            {
                Literal litNode = e.Item.FindControl("litNode") as Literal;
                litNode.Text = e.Item.SiteMapNode.Description;
            }
            else if (e.Item.ItemType == SiteMapNodeItemType.Root)
            {
                HyperLink hplnkNode = e.Item.FindControl("hplnkNode") as HyperLink;
                hplnkNode.Style.Add(HtmlTextWriterStyle.Display, "none");
            }
            else if (e.Item.ItemType != SiteMapNodeItemType.PathSeparator)
            {
                HyperLink hplnkNode = e.Item.FindControl("hplnkNode") as HyperLink;
                hplnkNode.Text = e.Item.SiteMapNode.Description;
                hplnkNode.NavigateUrl = e.Item.SiteMapNode.Url;
            }
            else if (e.Item.ItemType == SiteMapNodeItemType.PathSeparator)
            {
                if (e.Item.ItemIndex == 1)
                {
                    HtmlGenericControl spnNode = e.Item.FindControl("spnNode") as HtmlGenericControl;
                    spnNode.Style.Add(HtmlTextWriterStyle.Display, "none");
                }
            }
            else
            {
                //Do Nothing
            }
        }
    }
}